﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucBet.ascx.cs" Inherits="WSBulTasDesa.UserControls.ucBet" %>
<asp:GridView ID="grvBet" AutoGenerateColumns="false" CellSpacing="0" runat="server"
    BorderStyle="Solid" BorderWidth="1px" CellPadding="0" ShowHeaderWhenEmpty="True"
    DataKeyNames="Id" OnRowCancelingEdit="grvBetCamp_RowCancelingEdit" OnRowEditing="grvBetCamp_RowEditing"
    OnRowUpdating="grvBetCamp_RowUpdating" OnRowDeleting="grvBetCamp_RowDeleting">
    <Columns>
        <asp:TemplateField>
            <HeaderTemplate>
                Mejora
                <br />
                <asp:TextBox ID="txtName" runat="server" Text=""></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="txtName"
                    Display="None" ErrorMessage="Ingrese nombre." ValidationGroup="Add"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceName" TargetControlID="rfvName"
                    Width="150px" />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="lblId" runat="server" Text='<%# Bind("Name") %>' />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="txtName"
                    Display="None" ErrorMessage="Ingrese nombre." ValidationGroup="Edit"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceName" TargetControlID="rfvName"
                    Width="150px" />
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <HeaderTemplate>
                U/M<br />
                <asp:DropDownList ID="ddlMeasureUnit" runat="server">
                    <asp:ListItem Text="<>" Value=""></asp:ListItem>
                    <asp:ListItem>un</asp:ListItem>
                    <asp:ListItem>m2</asp:ListItem>
                    <asp:ListItem>kv</asp:ListItem>
                    <asp:ListItem>tn</asp:ListItem>
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="rfvMeasureUnit" runat="server" ControlToValidate="ddlMeasureUnit"
                    Display="None" ErrorMessage="Ingrese U/M." ValidationGroup="Add"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceMeasureUnit" TargetControlID="rfvMeasureUnit"
                    Width="150px" />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="lblMeasureUnite" runat="server" Text='<%# Bind("MeasureUnit") %>' />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:DropDownList ID="ddlMeasureUnit" runat="server" SelectedValue='<%# Eval("MeasureUnit") %>'>
                    <asp:ListItem Text="<>" Value=""></asp:ListItem>
                    <asp:ListItem>un</asp:ListItem>
                    <asp:ListItem>m2</asp:ListItem>
                    <asp:ListItem>kv</asp:ListItem>
                    <asp:ListItem>tn</asp:ListItem>
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="rfvMeasureUnit" runat="server" ControlToValidate="ddlMeasureUnit"
                    Display="None" ErrorMessage="Ingrese U/M." ValidationGroup="Edit"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceMeasureUnit" TargetControlID="rfvMeasureUnit"
                    Width="150px" />
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField ItemStyle-HorizontalAlign="Right">
            <HeaderTemplate>
                Cant<br />
                <asp:TextBox ID="txtQuantity" runat="server" Text="" MaxLength="6" SkinID="txtGridView"></asp:TextBox>
                <ajaxToolkit:FilteredTextBoxExtender ID="ftbQuantity" runat="server" TargetControlID="txtQuantity"
                    FilterType="Custom, Numbers" ValidChars="." />
                <asp:RequiredFieldValidator ID="rfvQuantity" runat="server" ControlToValidate="txtQuantity"
                    ErrorMessage="Ingrese cantidad." Display="None" ValidationGroup="Add"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="revQuantity" runat="server" ControlToValidate="txtQuantity"
                    ValidationGroup="Add" ErrorMessage="Número decimal fuera del rango establecido"
                    Display="None" ValidationExpression="^[0-9]{1,6}(\.[0-9]{0,2})?$"></asp:RegularExpressionValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceQuantity" TargetControlID="rfvQuantity"
                    Width="150px" />
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceQuantityBis" TargetControlID="revQuantity"
                    Width="150px" />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="lblQuantity" runat="server" Text='<%# Bind("Quantity") %>' />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtQuantity" runat="server" Text='<%#Bind("QuantityString") %>'
                    MaxLength="6" SkinID="txtGridView"></asp:TextBox>
                <ajaxToolkit:FilteredTextBoxExtender ID="ftbQuantity" runat="server" TargetControlID="txtQuantity"
                    FilterType="Custom, Numbers" ValidChars="." />
                <asp:RequiredFieldValidator ID="rfvQuantity" runat="server" ControlToValidate="txtQuantity"
                    ErrorMessage="Ingrese cantidad." Display="None" ValidationGroup="Add"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="revQuantity" runat="server" ControlToValidate="txtQuantity"
                    ValidationGroup="Add" ErrorMessage="Número decimal fuera del rango establecido"
                    Display="None" ValidationExpression="^[0-9]{1,6}(\.[0-9]{0,2})?$"></asp:RegularExpressionValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceQuantity" TargetControlID="rfvQuantity"
                    Width="150px" />
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceQuantityBis" TargetControlID="revQuantity"
                    Width="150px" />
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField ItemStyle-HorizontalAlign="Right">
            <HeaderTemplate>
                U$S/cant<br />
                <asp:TextBox ID="txtValue" runat="server" Text="" SkinID="txtGridView"></asp:TextBox>
                <ajaxToolkit:FilteredTextBoxExtender ID="ftbValue" runat="server" TargetControlID="txtValue"
                    FilterType="Custom, Numbers" />
                <asp:RequiredFieldValidator ID="rfvValue" runat="server" ControlToValidate="txtValue"
                    ErrorMessage="Ingrese valor unitario." Display="None" ValidationGroup="Add"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceValue" TargetControlID="rfvValue"
                    Width="150px" />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="lblValue" runat="server" Text='<%# Bind("Value") %>' />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtValue" runat="server" Text='<%# Bind("Value") %>' SkinID="txtGridView"></asp:TextBox>
                <ajaxToolkit:FilteredTextBoxExtender ID="ftbValue" runat="server" TargetControlID="txtValue"
                    FilterType="Custom, Numbers" />
                <asp:RequiredFieldValidator ID="rfvValue" runat="server" ControlToValidate="txtValue"
                    ErrorMessage="Ingrese valor unitario." Display="None" ValidationGroup="Edit"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceValue" TargetControlID="rfvValue"
                    Width="150px" />
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
            <HeaderTemplate>
                <asp:Button ID="btnAdd" runat="server" Text="Agregar" OnClick="btnAdd_Click" ValidationGroup="Add" />
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="lblTotalItem" runat="server" Text='<%# Bind("Total") %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center">
            <ItemStyle Width="40px" HorizontalAlign="Center" />
            <ItemTemplate>
                <asp:ImageButton ID="imbtnEdit" runat="server" ImageUrl="~/Img/edit.PNG" CommandName="Edit"
                    CausesValidation="False" />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:ImageButton ID="ibtnUpdate" runat="server" CommandName="Update" ImageUrl="~/Img/confirmEdit.PNG"
                    ValidationGroup="Edit"></asp:ImageButton>
                <asp:ImageButton ID="ibtnCancel" runat="server" CommandName="Cancel" ImageUrl="~/Img/cancelEdit.PNG"
                    CausesValidation="false"></asp:ImageButton>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemStyle Width="20px" HorizontalAlign="Center" />
            <ItemTemplate>
                <asp:ImageButton ID="imbtnDelete" runat="server" ImageUrl="~/Img/delete.PNG" CommandName="Delete"
                    CausesValidation="False" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
